#include <unistd.h>
#include <signal.h>
#include <stdio.h>

void handler(int signum){
    if(signum == SIGALRM){
        printf("receive SIGALARM signal\n");
    }

    if(signum == SIGCONT){
        printf("receive SIGCONT signal\n");
    }
    //无法捕获kill，默认会被系统忽略
    if(signum == SIGKILL){
        printf("receive SIGKILL signal\n");
    }
}
int main(){
    int pid = getpid();
    printf("pid is %d\n", pid);
    //注册信号
    signal(SIGALRM,handler);
    signal(SIGCONT, handler);
    signal(SIGKILL, handler);
    //启动定时器
    alarm(15);
    pause();
    printf("I wake up\n");
    return 0;
}